students = [{'name': '小明', 'age':10, 'gender':'male'},
            {'name':'小红', 'age':12, 'gender':'female'},
            {'name':'小李', 'age':12, 'gender':'male'}
            ]

def show_students():
    print("""
     行号        姓名       年龄        性别  
    ---------------------------------------
    """)

    for i, stu in enumerate(students):
        name = stu['name']
        age = stu['age']
        gender = stu['gender']
        print(f"\t\t{i+1}\t\t{name}\t\t{age}\t\t{gender}")


def add_student():
    new_name = input('请输入要添加学生的新姓名：')
    new_age = int(input('请输入要添加学生的新年龄：'))
    new_gender = input('请输入要添加学生的新性别：')
    new_student = {'name': new_name, 'age': new_age, 'gender':new_gender}
    students.append(new_student)
    print('添加完成')
    show_students()


while True:
    print("""
    1-查询学员姓名
    2-添加学员姓名
    3-修改学员姓名
    4-删除学员姓名
    0-退出程序
  
    """)

    select_num = int(input('请选择操作？'))

    if select_num == 1:
        show_students()
    elif select_num == 2:
        add_student()
    elif select_num == 0:
        print('下次再见')
        break